-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: resolve diff editor race condition in multi-monitor setups #4394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
daniel-lxs
reviewed
Jun 7, 2025
Member
daniel-lxs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Mnehmos, Great fix! I can confirm that it works, I left a couple of minor suggestions that might be worth looking into.
Let me know what you think
Co-authored-by: Daniel <[email protected]>
No async / await: We don't need to await the timeout. We just want to schedule checkAndResolve to run in the future, not pause the entire function. setTimeout does this perfectly on its own. No if Statement: The confusing if statement is gone. We are no longer checking the return value because we don't need to do anything with it in this specific spot. The primary purpose here is just to trigger the check. Clear Intent: The corrected code is much clearer. Its only job is to kick off the checkAndResolve function after 100ms. This acts as a simple, manual trigger to supplement the main onDidChangeTabGroups event listener, which is the more robust part of the fix.
- Add proper handling for checkAndResolve() return value in setTimeout callback - Enhance tab group change listener to handle boolean return value appropriately - Add debug logging for better troubleshooting of diff editor opening issues - Maintain all existing functionality while addressing code review feedback Addresses review feedback from Daniel in PR RooCodeInc#4394 regarding incomplete conditional handling around line 484.
daniel-lxs
pushed a commit
that referenced
this pull request
Jun 13, 2025
- Add proper handling for checkAndResolve() return value in setTimeout callback - Enhance tab group change listener to handle boolean return value appropriately - Add debug logging for better troubleshooting of diff editor opening issues - Maintain all existing functionality while addressing code review feedback Addresses review feedback from Daniel in PR #4394 regarding incomplete conditional handling around line 484.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
PR - Changes Requested
size:L
This PR changes 100-499 lines, ignoring generated files.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related GitHub Issue
Closes: #4199
Description
This pull request re-implements the changes from the original PR #4385.
The primary change is a fix for a race condition in the
DiffViewProviderthat could prevent the diff editor from opening reliably. The previous implementation usedonDidChangeActiveTextEditor, which was not always triggered correctly. This has been replaced with a more robust approach that listens foronDidChangeTabGroupsand polls for the diff tab's existence, ensuring the editor is resolved correctly even on slower systems.All debugging
console.logstatements and a superfluous test file have been removed from the original changes.Test Procedure
Type of Change
srcor test files.Pre-Submission Checklist
npm run lint).console.log) has been removed.npm test).mainbranch.npm run changesetif this PR includes user-facing changes or dependency updates.Screenshots / Videos
Not applicable. This change fixes a race condition and has no visual component.
Documentation Updates
Additional Notes
This PR is a recreation of #4385 after the original branch was accidentally deleted.
Get in Touch
Mnehmos
Important
Fixes race condition in
DiffViewProviderby changing event listener and adding polling, ensuring reliable diff editor opening.DiffViewProviderby replacingonDidChangeActiveTextEditorwithonDidChangeTabGroupsand adding polling for diff tab existence.console.logstatements fromDiffViewProvider.This description was created by
for 2321243. You can customize this summary. It will automatically update as commits are pushed.